﻿using System;
namespace Kis.Xroad.Eu {
    
    
    [System.SerializableAttribute()]
    public class AnonymousAtomicListType : global::Xtee.Core.Types.ListTypeBase<AnonymousAtomicListType.StringType> {
        
        public const string SMALL = "small";
        
        public AnonymousAtomicListType(string value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (value.ToString() == "small") {
                annot = "small";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,value.ToString()));;
            }
        }
        
        public AnonymousAtomicListType() : 
                base(new System.Collections.Generic.List<StringType>()) {
        }
        
        public AnonymousAtomicListType(System.Collections.Generic.IList<StringType> value) : 
                base(value) {
            this.Validate();
            string annot = null;
            if (ToString() == "small") {
                annot = "small";
            }
            if (annot!=null) {
                this._annotation = annot;
            }
            else {
                throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,ToString()));;
            }
        }
        
        public static bool TryParse(string value, out global::Kis.Xroad.Eu.AnonymousAtomicListType result) {
            try {
                result = new global::Kis.Xroad.Eu.AnonymousAtomicListType(value);
                return true;
            }
            catch (System.Exception ) {
                result = null;
                return false;
            }
        }
        
        public static global::Kis.Xroad.Eu.AnonymousAtomicListType Parse(string value) {
            global::Kis.Xroad.Eu.AnonymousAtomicListType _AnonymousAtomicListType = null;
            if (global::Kis.Xroad.Eu.AnonymousAtomicListType.TryParse(value,out _AnonymousAtomicListType)) {
                return new AnonymousAtomicListType(_AnonymousAtomicListType);
            }
             throw new FormatException("Cannot parse to type [global::Kis.Xroad.Eu.AnonymousAtomicListType] from string value : [" + value + "]");;
        }
        
        public override StringType ParseElement(string value) {
            return new StringType(value);
        }
        
        [System.SerializableAttribute()]
        public class StringType : global::Kis.Xroad.Eu.SizeType {
            
            public const string SMALL = "small";
            
            public const string MEDIUM = "medium";
            
            public StringType(string value) : 
                    base(value) {
                this.Validate();
                string annot = null;
                if (Value == "small") {
                    annot = "small";
                }
                if (Value == "medium") {
                    annot = "medium";
                }
                if (annot!=null) {
                    this._annotation = annot;
                }
                else {
                    throw new global::Xtee.Core.Types.XteeSimpleTypeValidationException(string.Format("Enumeration on [{0}] does not allow value : [{1}] ", this.GetType().Name,Value.ToString()));;
                }
            }
            
            public StringType() : 
                    base(string.Empty) {
            }
            
            public static bool TryParse(string value, out StringType result) {
                try {
                    result = new StringType(value);
                    return true;
                }
                catch (System.Exception ) {
                    result = null;
                    return false;
                }
            }
            
            public static implicit operator String (StringType value) {
                return value.Value;
            }
            
            public static implicit operator StringType (string value) {
                if (value==null) {
                    return null;
                }
                return new StringType(value);
            }
        }
    }
}
